%   This work demostrates one kind of DLS method to fit ellipse
%   Input x,y
x=[4.6,3.43,0.51,-2.6,-4.1,-3.862,-2.19,1.084,3.446,5.576,4.637]';
y=[0,2.94,4.76,4.76,2.94,0,-2.94,-4.76,-4.76,-2.94,0]';
%   Get the parameters A-F
[A,B,C,D,E,F]=FitEllipse(x,y);
%   Visualization
syms x1 y1;
plot(x,y,'line','none','marker','o','color','b');
hold on;
h=ezplot(A*x1.^2+B*x1*y1+C*y1.^2+D*x1+E*y1+F);
set(h,'color','r');
xlabel('x');
ylabel('y');
title('Fitting Ellipse using DLS method with constraint 4ac-b^2=1');